package com.study.common.jdbc;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

/**
 * 完整的ORM工具类 - 具备（参数绑定、SQL生成、结果映射）
 *
 * @author: chenhs
 * @date: Created in 19:05 2019/11/19
 **/
@Component
public class MyJdbcTemplate {

    @Autowired
    MyTransactionManager myTransactionManager;

    public void execute(String sql) throws SQLException {
        Connection connection = myTransactionManager.getConnection();
        Statement statement = connection.createStatement();
        statement.execute(sql);
    }

}
